package com.ftg.learn.chapter16;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 学习spring 基于配置文件
 *
 * 1 : 依赖
 * 2 : xml (核心方法提供大量参数)
 * 3 : 一个调用类完成调用
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/3/27 上午8:17
 */
public class LearnSpringByXmlBase {


    public static void main(String[] args) {
        BeanFactory beanFactory = new ClassPathXmlApplicationContext("application.xml");
//        Dog dog1 = (Dog) beanFactory.getBean("dog");
//        Dog dog2 = (Dog)beanFactory.getBean("dog");
//        //自动单例
//
//        System.out.println(dog2);

//        YangTree my = (YangTree) beanFactory.getBean("yangtree");
//        System.out.println(my);
//        System.out.println(my.getTid());
//        System.out.println(my.getDesc());
//        BClass bClass = (BClass) beanFactory.getBean("bclass");
//
//        System.out.println(bClass.getAt().getName());

        Cclass c = beanFactory.getBean(Cclass.class);
        System.out.println(c);

    }


}
